/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pl.org.waff.example;

import java.util.HashMap;

/**
 *
 * @author greg
 */
public class LoginForm {

    private String login;
    private String password;
    private int errorCode = -1;
    private HashMap users = new HashMap();

    //TODO: dispatcher and URL after login
    public void init(String config) {
        users.put("greg", "secretkey");
        return;
    }

    /**
     * @param login the login to set
     */
    public void setLogin(String login) {
        this.login = login;
    }

    /**
     * @param password the password to set
     */
    public void setPassword(String password) {
        this.password = password;
    }

    public void login() { 
        if (getLogin() == null || getPassword() == null) {
            errorCode = 1;
        } else {
            errorCode = 0;
        }
    }

    /**
     * @return the errorCode
     */
    public int getErrorCode() {
        return errorCode;
    }

    /**
     * @return the login
     */
    public String getLogin() {
        return login;
    }

    /**
     * @return the password
     */
    public String getPassword() {
        return password;
    }
}
